package com.zr.gdms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zr.gdms.service.ScoreService;
import com.zr.gdms.serviceimpl.ScoreServiceImpl;

import net.sf.json.JSONObject;
/**
 * 查询成绩
 * @author 李培宁
 *
 */
public class SearchScoreControllerLPN extends HttpServlet{

	ScoreService ss = new ScoreServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		this.doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		resp.setCharacterEncoding("utf8");
		int page = Integer.parseInt(req.getParameter("page"));
		int rows  = Integer.parseInt(req.getParameter("rows"));
		int score1 =Integer.parseInt(req.getParameter("score1")) ;
		int score2 = Integer.parseInt(req.getParameter("score2"));
		HttpSession  session = req.getSession();
		JSONObject j = ss.searchScore(page, rows, score1, score2);
		PrintWriter pw = resp.getWriter();
		pw.write(j.toString());
		pw.flush();
		pw.close();
	}
}
